//获取元素节点的当前属性的值  attr 表示属性名称
function getStyleAttr(obj,attr){
	
	if(window.getComputedStyle){
		
		return getComputedStyle(obj,null)[attr];
		
	}else{
		
		return  obj.currentStyle[attr];
		
	}
}


function move(obj,attr,iTarget,fun){
	clearInterval(obj.timer);
	obj.timer = setInterval(function(){
		if(attr =="opacity"){
			var current  = parseFloat(getStyleAttr(obj,attr)*100);
			current = Math.round(current);
		}else{
			var current  = parseFloat(getStyleAttr(obj,attr));
			current = Math.round(current);
		}
		
		var speed = (iTarget -current )>0 ? Math.ceil((iTarget -current )/8):Math.floor((iTarget -current )/8);
		
		if(iTarget==current){
			clearInterval(obj.timer);
			if(fun){
				fun();
			}
		}
		if(attr == "opacity"){
			obj.style.opacity = (speed+ current )/100;
			obj.style.filter = "alpha(opacity="+(speed+ current ) +")";
		}else{
			obj.style[attr] = speed+ current +"px";
		}
	},30)
}
